import http from "@/api";

import { ResPage } from "@/api/interface";
import { BillEntity, BillRiseVo, BillVo } from "@/biz/interface/BillType";

import { ModuleFlexJobUrl } from "..";

const moduleUrl = ModuleFlexJobUrl;

// * 获取列表
export const getBillVoListApi = (params: {}) => {
  return http.post<ResPage<BillVo>>(moduleUrl + `/billapi/userbills`, params);
};

// * 新增接口
export const saveBillApi = (company: BillEntity) => {
  return http.post(moduleUrl + `/billapi/billapply`, company);
};

// * 详情接口
export const getBillInfoApi = (params: { id: string }) => {
  return http.post<BillEntity>(moduleUrl + `/billapi/billinfo`, params);
};

// * 删除接口
export const getBillCntApi = () => {
  return http.post(moduleUrl + `/billapi/userbillscnt`, {});
};

// * 删除接口
export const deleteBillApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/billapi/billcancel`, params);
};

// * 获取下拉选择
export const getBillRisesApi = () => {
  return http.post<ResPage<BillRiseVo>>(moduleUrl + `/billapi/billrisesuser`, { pageSize: 1000 });
};

// * 获取可开票的岗位列表
export const getCanBillJobsByIdsApi = (params: { ids: string[] }) => {
  return http.post<ResPage<BillRiseVo>>(moduleUrl + `/billapi/billitemsbyids`, params);
};

// * 获取可开票的岗位列表
export const getCanBillJobsApi = (params: {}) => {
  return http.post<ResPage<BillRiseVo>>(moduleUrl + `/billapi/billitemslist`, params);
};
